import "package:flutter/material.dart";

class AnimateComingSoonItem {
  String coverUrl; //封面
  String title; //标题
  String date; //日期
  AnimateComingSoonItem({
    required this.coverUrl,
    required this.title,
    required this.date,
  });
}

// ignore: must_be_immutable
class AnimateComingSoon extends StatelessWidget {
  List<AnimateComingSoonItem> list = [
    AnimateComingSoonItem(
      coverUrl: './images/1.jpg',
      title: '赘婿 第二季',
      date: "2024-07-29",
    ),
    AnimateComingSoonItem(
      coverUrl: './images/1.jpg',
      title: '怪想售',
      date: "2024-08-05",
    ),
    AnimateComingSoonItem(
      coverUrl: './images/1.jpg',
      title: '笼中人',
      date: "2024-08-06",
    ),
    AnimateComingSoonItem(
      coverUrl: './images/1.jpg',
      title: '白色闪电',
      date: "2024-07-20",
    ),
    AnimateComingSoonItem(
      coverUrl: './images/1.jpg',
      title: '戏精宿舍',
      date: "2024-08-29",
    ),
  ];
  AnimateComingSoon({super.key});
  @override
  Widget build(BuildContext context) {
    return SliverToBoxAdapter(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            padding: const EdgeInsets.fromLTRB(12, 18, 0, 2),
            child: const Text(
              '即将上线',
              style: TextStyle(fontWeight: FontWeight.bold),
            ),
          ),
          Container(
            height: 190,
            padding: const EdgeInsets.only(left: 4),
            child: ListView.builder(
              scrollDirection: Axis.horizontal,
              itemCount: list.length,
              itemBuilder: (context, index) {
                var item = list[index];
                return Container(
                  margin: EdgeInsets.only(
                      left: 7, right: index == list.length - 1 ? 12 : 0),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      SizedBox(
                        width: 96,
                        child: Row(
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            Text(
                              item.date,
                              style: const TextStyle(
                                fontSize: 13,
                                color: Color.fromARGB(158, 0, 0, 0),
                              ),
                            ),
                            Expanded(
                              child: Container(
                                margin: const EdgeInsets.only(left: 3),
                                height: 1,
                                decoration: const BoxDecoration(
                                  color: Color.fromARGB(46, 0, 0, 0),
                                ),
                              ),
                            ),
                          ],
                        ),
                      ),
                      Stack(
                        children: [
                          Container(
                            margin: const EdgeInsets.only(top: 12),
                            width: 96,
                            height: 156,
                            child: ClipRRect(
                              borderRadius: BorderRadius.circular(6),
                              child: Image.asset(
                                item.coverUrl,
                                fit: BoxFit.cover,
                              ),
                            ),
                          ),
                          Positioned(
                            left: 0,
                            right: 0,
                            bottom: 0,
                            child: Container(
                              padding: const EdgeInsets.all(8),
                              child: Column(
                                children: [
                                  Padding(
                                    padding: const EdgeInsets.only(bottom: 6),
                                    child: Text(
                                      item.title,
                                      style: const TextStyle(
                                        color: Colors.white,
                                        fontSize: 13,
                                        fontWeight: FontWeight.bold,
                                      ),
                                    ),
                                  ),
                                  Container(
                                    padding: const EdgeInsets.only(
                                        top: 6, bottom: 6),
                                    decoration: BoxDecoration(
                                      color: const Color.fromARGB(
                                          122, 255, 255, 255),
                                      borderRadius: BorderRadius.circular(6),
                                    ),
                                    child: const Row(
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      crossAxisAlignment:
                                          CrossAxisAlignment.center,
                                      children: [
                                        Icon(
                                          Icons.add_to_drive_sharp,
                                          color: Colors.white,
                                          size: 16,
                                        ),
                                        Text(
                                          '想看',
                                          style: TextStyle(
                                            color: Colors.white,
                                            fontSize: 12,
                                          ),
                                        )
                                      ],
                                    ),
                                  )
                                ],
                              ),
                            ),
                          )
                        ],
                      )
                    ],
                  ),
                );
              },
            ),
          ),
        ],
      ),
    );
  }
}
